import { DependencyContainer, toSuccess } from "@sker/core"
import {
    AutoDevice,
    AutoDeviceWork,
    AutoFile,
    AutoRed,
    AutoRed2,
    AutoRedLog, AutoRedOpenLog,
    AutoTask, AutoTaskScript, AutoTaskScriptLog, AutoTaskScriptNotFound,
    AutoUser, AutoUserLog, KsAccount,
    KsAccountAttention,
    KsAccountFollow,
    KsAccountLog,
    KsDevice, KsDeviceAccount,
    KsLiveRoom, KsLiveRoomDayLog, KsLiveRoomJoinCount, KsLiveRoomLog,
    KsOpen,
    KsPackage,
    KsPage,
    KsRedPacket,
    KsTopic
} from "@sker/entities"
import { useDataSource } from '@sker/orm'

export default async (injector: DependencyContainer) => {
    const ds = await useDataSource([
        AutoUser,
        AutoUserLog,
        KsAccount,
        AutoRed,
        AutoRedLog,
        AutoRedOpenLog,
        AutoDevice,
        AutoTask,
        AutoTaskScript,
        AutoTaskScriptLog,
        AutoTaskScriptNotFound,
        AutoDeviceWork,
        AutoRed2,
        KsAccountAttention, KsDevice, KsDeviceAccount, KsRedPacket, KsLiveRoom, KsLiveRoomLog, KsTopic,
        KsPage, KsAccountFollow, KsLiveRoomDayLog,
        AutoFile, KsAccountLog, KsLiveRoomJoinCount, KsPackage,
        KsOpen
    ], injector, true)
    await ds.destroy()
    return toSuccess(true)
}
